package com.blb.ssm.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.blb.ssm.entity.Supplier;

public interface SupplierMapper {
	
	List<Supplier> getlist(@Param("scom")String scom,@Param("stel")String stel, @Param("start")int start,@Param("limit")int limit);
	
	int getcount(@Param("scom")String scom,@Param("stel")String stel);
	
	@Delete("delete from supplier where sid=#{sid}")
	void delSupplier(String sid);
	
	@Select("select * from supplier where scom=#{scom}")
	Supplier selectSupplierByScom(String scom);
	
	@Insert("insert into supplier values(#{sid},#{scom},#{stype},#{sname},#{stel},#{spay},#{sagio},#{sadd},#{smsg},#{sdef},#{sstage})")
	void addSupplier(Supplier supplier);
	
	@Select("select * from supplier where sdef=1")
	Supplier checkSdef();
	
	@Update("update supplier set sdef=0 where sid=#{sid}")
	void updateSdef(String sid);
	
	@Update("update supplier set scom=#{scom},stype=#{stype},sname=#{sname},stel=#{stel},spay=#{spay},sagio=#{sagio},sadd=#{sadd},smsg=#{smsg},sdef=#{sdef},sstage=#{sstage} where sid=#{sid}")
	void updateSupplier(Supplier supplier);

	@Select("select sid from supplier where scom=#{scom}")
	String selectSupplierBySID(String scom);

}
